var clerkData = "";
/*初始化*/
function initial(){
    /**
    JSON.stringify()是将JavaScript对象转换为json字符串
    JSON.parse(jsonstr)是将json字符串转换为javascript对象
    */
    $.ajax({
        url:"http://localhost/PersonManSystem/record/record/withoutcheck.action",
        type:"get",
        dataType:'json',
        contentType:'application/json;charset=utf-8',
        success:function(data){
            clerkData = data;
            var Recordsid;
            var nochecknum = data['msg'];
            document.getElementById("nochecknum").value = nochecknum;

            $(data['data']).each(function(){

            var tbody=$('<tr style="FONT-WEIGHT: bold; FONT-STYLE: normal; BACKGROUND-COLOR: #eeeeee; TEXT-DECORATION: none"></tr>');

            tbody.append("<td>"+this.recordsid+"</td>");
            Recordsid = this.recordsid;
            tbody.append("<td>"+this.clerkname+"</td>");
            tbody.append("<td>"+this.clerksex+"</td>");
            tbody.append("<td>"+this.firstinstname+"</td>");
            tbody.append("<td>"+this.secondinstname+"</td>");
            tbody.append("<td>"+this.thirdinstname+"</td>");
            tbody.append("<td>"+this.posname+"</td>");

            tbody.append("<td><input type='button' id='"+Recordsid+"' value='复核' onclick='getid(this)'></td>");

            $("#grid").append(tbody);

        });
    },
        error:function(XMLHttpRequest, textStatus, errorThrown){
            alert("Error");
            alert(XMLHttpRequest.status);
            alert(XMLHttpRequest.readyState);
            alert(textStatus);
        }
    });
}


function getid(obj){
    $(clerkData['data']).each(function(){
        if(this.recordsid == obj.id){
            sessionStorage.setItem("firstinstnameee1", this.firstinstname);
            sessionStorage.setItem("secondinstnameee1", this.secondinstname);
            sessionStorage.setItem("thirdinstnameee1", this.thirdinstname);
            sessionStorage.setItem("thirdpositionee1", this.posname);
            sessionStorage.setItem('recordsidd1',obj.id);
        }
    });
    window.location='RLDJFH_1.html';
   // submitData(obj);
}
